const Koa = require('Koa');

const Router = require('koa-router');

const app = new Koa();

// 添加请求前缀/jspang才能访问到
const router = new Router({
    prefix: '/jspang'
});

app
    .use(router.routes())
    .use(router.allowedMethods());

router
    .get('/', (ctx, next) => {
        ctx.body = 'Hello jspang'
    })
    .get('/todo', (ctx, next) => {
        ctx.body = 'todo.html pages'
    });

app.listen(3000, () => {
    console.log('koa server starting demo6.js')
})
